import request from "@/utils/request";

// 生成新的考勤记录
export function buildNewRecords(query) {
  return request({
    url: "/v2/workJobApi/monthlyAttendance/build",
    method: "get",
    params: query
  });
}

// 统计结果
export function indexStatistics(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/statistics?date=${params.date}&groupId=${params.groupId}&deptId=${params.deptId}`,
    method: "GET"
  });
}

// 详情统计结果
export function detailStatistics(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/details`,
    method: "GET",
    params
  });
}

// 详情统计结果
export function updateDetails(datas) {
  console.log(datas);
  return request({
    url: `/v2/workJobApi/monthlyAttendance/update`,
    method: "PUT",
    data: datas
  });
}

// 历史记录
export function histories(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/history`,
    method: "GET",
    params
  });
}

// 打卡详情
export function cardDetails(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/cards`,
    method: "GET",
    params
  });
}

// 导出日考勤明细
export function downloadDetail(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/export`,
    method: "GET",
    params
  });
}

// 日考勤确认
export function confirm(data) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/confirm`,
    method: "POST",
    data
  });
}

// 月考勤首页数据
export function monthHome(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/homeData`,
    method: "GET",
    params
  });
}

// 异常考勤结果
export function invalid(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/invalid`,
    method: "GET",
    params
  });
}

// 月考勤明细
export function downloadMonthDetail(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/month/export`,
    method: "GET",
    params
  });
}

// 月考勤明细
export function monthDetail(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/month/detail`,
    method: "GET",
    params
  });
}

// 月考勤明细[不分页]
export function monthDetails(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/month/details`,
    method: "GET",
    params
  });
}

// 月考勤可选项
export function monthOptions(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/options`,
    method: "GET",
    params
  });
}


// 某日打卡时间
export function signTimesAtDate(params) {
  return request({
    url: `/v2/workJobApi/monthlyAttendance/all/signTimes`,
    method: "GET",
    params
  });
}
